package Computer;

public class Computer {
    public void poweron(){
        System.out.println("打开电脑");
    }
    public void poweroff(){
        System.out.println("关闭电脑");
    }

    public void usbDevice(Iusb usb){    //这里卡住了
        usb.openDevice();
        if(usb instanceof Mouse){   //instanceof 忘了
            Mouse mouse = (Mouse) usb;  //为什么要强转
            mouse.click();
        }else if(usb instanceof Keyboard){
            Keyboard keyboard = (Keyboard) usb;
            keyboard.input();
        }else{

        }
        usb.closeDevice();
    }
}
